home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / before / ltchars.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  807 b   |  44 lines

  1. /*
  2.  * illustrates the use of extended tty charateristics
  3.  *
  4.  */
  5.  
  6. #include <stdio.h>
  7. #include <sys/types.h>
  8. #include <sys/ioctl.h>
  9. #include <sys/ttold.h>
  10.  
  11. #ifdef TIOCSLTC
  12. struct ltchars old_chars, new_chars;
  13. #define ctl(c) ((c)&037)
  14. #endif
  15.  
  16. main () 
  17. {
  18. #ifdef TIOCSLTC
  19.     /*
  20.      * save off ltchars settings,
  21.      * and change some
  22.      */
  23.     (void)ioctl(fileno(stdin), TIOCGLTC, (char *)&old_chars);
  24.     new_chars = old_chars;
  25.     if (old_chars.t_lnextc == ctl('v'))
  26.         new_chars.t_lnextc = -1;
  27.     if (old_chars.t_rprntc == ctl('r'))
  28.         new_chars.t_rprntc = -1;
  29.     (void)ioctl(fileno(stdin), TIOCSLTC, (char *)&new_chars);
  30. #endif
  31. }
  32.  
  33. /*
  34.  * on program exit, restore old ltchars settings
  35.  */
  36. void
  37. on_quit()
  38. {
  39. #ifdef TIOCSLTC
  40.     (void)ioctl(fileno(stdin), TIOCSLTC, (char *)&old_chars);
  41. #endif
  42. }
  43.  
  44.